<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Grom Hellscream
 * Date: 11/2/12
 * Time: 11:33 AM
 * To change this template use File | Settings | File Templates.
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();

$huongnghiencuus = $this->get('huongnghiencuu');
$chitietcongtrinh = $this->get('chitietcongtrinh');
$tailieus = $this->get('tailieus');
$canbo = $this->get('canbo');
$phongs = $this->get('phong');
if (count($phongs) > 1) 
    $phong = $phongs[0];
elseif (count($phongs) == 1)
    $phong = $phongs;
$donvis = $this->get('donvi');
if (count($donvis) > 1)
    $donvi = $donvis[0];
elseif (count($donvis) == 1)
    $donvi = $donvis;
$khoi = $this->get('khoi');
$hosocanbo = VastHelper::getHosocanbo();
?>

<div id="crumbs">
    <div style="color: #222222;font-weight: normal;margin: 0;padding: 0">
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=vast') ?>">Trang chủ</a> »
        <span>Cơ cấu tổ chức</span> »
        <?php if (isset($khoi)): ?>        
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=donvitructhuoc&id=' . $khoi->id); ?>"><?php echo $khoi->ten ?></a> »                
        <?php endif; ?>
        <?php if (isset($donvi)): ?>
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=phongtructhuocs&id=' . $donvi->id); ?>"><?php echo $donvi->ten ?></a> »
        <?php endif; ?>
        <?php if (isset($phong)): ?>
        <span><?php echo $phong->ten; ?></span> »        
        <?php endif; ?>
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=chitietcanbo&id=' . $canbo->id); ?>"><?php echo $canbo->hoten; ?></a> »
        <span>Xem chi tiết công trình</span>
    </div>
</div>

<div id="main" class="home">
    <h3 class="title green">Tra cứu thông tin công trình của cán bộ <?php echo $canbo->hoten; ?></h3>
    
    <div class="single" style="margin-left: 10px;">
        <p style="text-align:justify;text-justify:inter-word;">
            <strong style="text-indent: 20px;">
                + Tên:
            </strong>
            <?php if (isset($chitietcongtrinh->ten) && !is_null($chitietcongtrinh->ten)) echo $chitietcongtrinh->ten; ?>
        </p>
            
        <p style="text-align:justify;text-justify:inter-word;">
            <strong style="text-indent: 20px;">
                + Ấn phẩm:
            </strong>
            <?php if (isset($chitietcongtrinh->anpham) && !is_null($chitietcongtrinh->anpham)) echo $chitietcongtrinh->anpham; ?>
        </p>

        <p style="text-align:justify;text-justify:inter-word;">
            <strong style="text-indent: 20px;">
                + Số trang:
            </strong>
            <?php if (isset($chitietcongtrinh->sotrang) && !is_null($chitietcongtrinh->sotrang)) echo $chitietcongtrinh->sotrang; ?>
        </p>

        <p style="text-align:justify;text-justify:inter-word;">
            <strong style="text-indent: 20px;">
                + Cơ quan xuất bản:
            </strong>
            <?php if (isset($chitietcongtrinh->coquanxuatban) && !is_null($chitietcongtrinh->coquanxuatban)) echo $chitietcongtrinh->coquanxuatban; ?>
        </p>

        <p style="text-align:justify;text-justify:inter-word;">
            <strong style="text-indent: 20px;">
                + Năm xuất bản:
            </strong>
            <?php if (isset($chitietcongtrinh->namxuatban) && !is_null($chitietcongtrinh->namxuatban)) echo $chitietcongtrinh->namxuatban; ?>
        </p>

        <p style="text-align:justify;text-justify:inter-word;">
            <strong style="text-indent: 20px;">
                + Thể loại:
            </strong>
            <?php if (isset($chitietcongtrinh->theloai) && !is_null($chitietcongtrinh->theloai)) echo $chitietcongtrinh->theloai; ?>
        </p>

        <?php if (count($tailieus) > 0): ?>
        <p style="text-align:justify;text-justify:inter-word;">
            <strong style="text-indent: 20px;">
                + Tài liệu liên quan:
                <?php if (JFactory::getUser()->authorise('vast.tailieu.create', 'com_vast') || (JFactory::getUser()->authorise('vast.tailieu.manage.own') && $chitietcongtrinh->hosocanbo_id == $hosocanbo->id)): ?>
                    <a href="index.php?option=com_vast&view=tailieu&layout=default&congtrinhid=<?php echo $chitietcongtrinh->id; ?>" style="font-size: 10px;font-style: italic;text-decoration:underline;">Bổ sung tài liệu</a>                    
                <?php endif; ?>
            </strong>
            <ol>
                <?php foreach ($tailieus as $tailieu): ?>
                    <li>
                        <?php echo $tailieu->mota; ?>
                        <a style="font-size: 10px;font-style: italic;text-decoration:underline;" href="<?php echo JURI::root() . str_replace('\\', '/', $tailieu->dinhkem); ?>">Xem tài liệu</a>
                        <?php if (JFactory::getUser()->authorise('vast.tailieu.edit', 'com_vast') || (JFactory::getUser()->authorise('vast.tailieu.manage.own') && $chitietcongtrinh->hosocanbo_id == $hosocanbo->id)): ?>
                        <a style="font-size: 10px;font-style: italic;text-decoration:underline;" href="<?php echo JRoute::_('index.php?option=com_vast&view=tailieu&layout=edit&congtrinhid=' . $chitietcongtrinh->id . '&tailieuid=' . $tailieu->id); ?>">
                            &nbsp;Cập nhật
                        </a>
                        <?php endif; ?>
                        <?php if (JFactory::getUser()->authorise('vast.tailieu.delete', 'com_vast') || (JFactory::getUser()->authorise('vast.tailieu.manage.own') && $chitietcongtrinh->hosocanbo_id == $hosocanbo->id)): ?>
                        <a onclick="return confirm('Bạn có chắc chắn muốn loại bỏ tài liệu này ?');" style="font-size: 10px;font-style: italic;text-decoration:underline;" href="<?php echo JRoute::_('index.php?option=com_vast&task=tailieu.delete&congtrinhid=' . $chitietcongtrinh->id . '&tailieuid=' . $tailieu->id); ?>">
                            &nbsp;Xóa tài liệu
                        </a>
                        <?php endif; ?>
                    </li>
                <?php endforeach; ?>
            </ol>
        </p>
        <?php endif; ?>
    </div>
    
    <hr style="height: 0px; border-top-color: #00ccff; border-right-color: #00ccff; border-bottom-color: #00ccff; border-left-color: #00ccff; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed;"/>
    
    <div style="float: left; width: 680px;">
        <?php
        if (isset($_SERVER['HTTP_REFERER']))
        {
            $url = htmlspecialchars($_SERVER['HTTP_REFERER']);
            echo '<a title="Quay lại" href="' . $url . '"><span style="left: 600px; position: relative;">&laquo; Quay lại</span></a>';            
        }
        ?>    
    </div>
    
</div>